package com.yunao.service.impl;

import com.yunao.dao.OrganizationRepository;
import com.yunao.entity.Organization;
import com.yunao.service.OrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrganizationServiceImpl implements OrganizationService {
    @Autowired
    private OrganizationRepository organRepository;


    @Override
    public List<Organization> findAll() {
        return organRepository.findAll();
    }

    @Override
    public Organization findOne(Integer id) {
        return organRepository.findById(id).get();
    }

    @Override
    public void save(Organization organization) {
        organRepository.save(organization);
    }

    @Override
    public void delete(Integer id) {
        organRepository.deleteById(id);
    }
}
